home *** CD-ROM | disk | FTP | other *** search
- Path: news.informatik.uni-muenchen.de!usenet
- From: watzka <watzka@stat.uni-muenchen.de>
- Newsgroups: comp.lang.c
- Subject: Re: What is &Variable (declared as: char Variable[10])?
- Date: Tue, 27 Feb 1996 17:54:00 +0100
- Organization: Institut fⁿr Statistik
- Message-ID: <31333728.1F2E@stat.uni-muenchen.de>
- NNTP-Posting-Host: pc9.stat.uni-muenchen.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Brenda wrote:
- >
- > schlein@umbc.edu (Jonas J. Schlein) wrote:
- > >Abu Wawda <wawda@alcor.usc.edu> wrote:
- > >|> I'm having trouble understanding what the address of a static array
- > >|> is.
- > >
- > >I'm having trouble understanding why it matters? You almost never use the
- > >address of an array directly unless doing something tricky with pointers
- > >or with particular dimensions of a multiple dimensional array.
- > >
- > >|> For example, if I declare a variable called myarray as:
- > >|> char myarray[10];
- > >|> then what could &myarray possibly mean? myarray is not a pointer, so
- > >|> &myarray could not possibly be the address of the variable myarray
- > >|> (like it would be if I did char* myarray and then asked for &myarray).
- > >
- > >Yes it could and yes it is...'myarray' is not a pointer, but &myarray is
- > >a pointer to 'myarray'.
- >
- > Um, that's not correct. myarray is DEFINITELY a pointer! As declared above,
- > it is a constant pointer to 10 contiguous char datatypes.
-
- "myarray" is _not_ a pointer, it is an array of 10 char. If you want to
- learn more about the difference (and similarities in expressions, where
- arrays _decay_ to pointers to the first array element) between arrays
- and pointers, see the very informative FAQ for this newsgroup.
-
- Kurt
-